<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of menu
 *
 * @author Dmitry
 */
class Models_Menu extends Access_Db {
  public function getMenu()
  {
    $select = array(
        "id",
        "name",
        "single",
        "parent_id"
    );
    $menu = array();
    $this->select($select, "side_menu", "visible='1' and menu='1' and parent_id=0 order by point asc");
    while($row = $this->getSelected())
    {
      $menu[] = $row;
    }
    return $menu;
  }
  
  public function getSubMenu($id)
  {
    $select = array(
        "id",
        "name",
        "single",
        "parent_id"
    );
    $menu = array();
    $this->select($select, "side_menu", "visible='1' and menu='1' and parent_id=$id");
    while($row = $this->getSelected())
    {
      $menu[] = $row;
    }
    return $menu;
  }
  
  public function getList()
  {
    $select = array(
        "id",
        "name",
        "single",
        "parent_id"
    );
    $menu = array();
    $this->select($select, "side_menu", "single='1'");
    while($row = $this->getSelected())
    {
        $menu[] = $row;
    }
    return $menu;
  }
  
  function getSiteMap()
  {
      
  }
}